package com.tm.d13_lambda;

import com.tm.d12_arrays.Student;

import java.util.Arrays;
import java.util.Comparator;
/**
 * 2024/5/25 学习Lambda表达式 Cjj 16:28
 */
public class LambdaTest2 {
    public static void main(String[] args) {
        Student[] students = new Student[4];
        students [0] = new Student("蜘蛛精",169.5,23);
        students [1] = new Student("紫霞",163.8,26);
        students [2] = new Student("紫霞",163.8,26);
        students [3] = new Student("至尊宝",167.5,24);

        Arrays.sort(students, (Student o1,Student o2)->{

                return Double.compare(o1.getHeight(), o2.getHeight());
            });
        System.out.println(Arrays.toString(students));
    }
}
